package com.briup;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.InputStream;

public class SqlSessionFactoryUtils {
    public static SqlSessionFactory getSqlSessionFactory(){
        String resource = "mybatis-config.xml";
        SqlSessionFactory build = null;
        try (InputStream resourceAsStream = Resources.getResourceAsStream(resource)) {
          build = new SqlSessionFactoryBuilder().build(resourceAsStream);
          return build;
        }catch (Exception e){
            e.printStackTrace();
        }
        return build;
    }
}
